package template;

public class ISHuiWen {
    public static void main(String[] args) {
        String s="abccba1";
        System.out.println(huiwen(s,0,s.length()-1));
        System.out.println(check(s));

    }
    public  static boolean huiwen(String str,int l,int r){
        if(l>=r) return true;
        if(str.charAt(l)!=str.charAt(r)) return false;
        return huiwen(str,l+1,l-1);
    }
    public static boolean check(String str){
        int n=str.length();
        if(n<=1) return true;
        if(str.charAt(0)!=str.charAt(n-1)) return false;
        return check(str.substring(1,n-1));
    }
}
